<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href='https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.min.css' rel='stylesheet'>
    <script type="text/javascript" >
        window.onload = function () {
            var mySelect = document.getElementById("mySelect");
            var opts = mySelect.options;
            for (var i = 0; i < opts.length; i++) {
                if (opts[i].value == ${brandId!'-1'}) {
                    opts[i].selected = true;
                }
            }
            var mySelect2 = document.getElementById("mySelect2");
            var opts = mySelect2.options;
            for (var i = 0; i < opts.length; i++) {
                if (opts[i].value == ${commTypeId!'-1'}) {
                    opts[i].selected = true;
                }
            }
            var mySelect3 = document.getElementById("mySelect3");
            var opts = mySelect3.options;
            for (var i = 0; i < opts.length; i++) {
                if (opts[i].value == ${status!'-1'}) {
                    opts[i].selected = true;
                }
            }
            var tianjia = document.getElementById("tianjia");
            tianjia.onclick = function () {
                location.href = "addShow";
            }

            var selAll = document.getElementById("selAll");
            selAll.onclick = function () {
                var allsel = document.getElementsByName("ids");
                /* uid为复选框的name属性值 */
                for (var i = 0; i < allsel.length; i++) {
                    allsel[i].checked = !allsel[i].checked;
                }
            }
        }
    </script>
</head>
<body>
<h3 contenteditable="true">商品列表</h3>
<div class="text-center">
    <div class="row-fluid">
        <div class="span12">
            <form class="form-search" action="/showPage">
                商品名称:<input class="input-medium search-query" type="text" placeholder="商品名称" name="commName"
                            value="${commName!''}"/>
                商品品牌:
                <select name="brandId" id="mySelect">
                    <option value="-1">请选择品牌</option>
                    <#list brands as brand>
                    <option value="${brand.bid}">${brand.bname}</option>
                    </#list>
                </select>
                商品品类:
                <select name="commTypeId" id="mySelect2">
                    <option value="-1">请选择品牌</option>
                    <#list types as type>
                        <option value="${type.typeId!''}">${type.typeName!''}</option>
                    </#list>
                </select>
                商品状态:
                <select name="status" id="mySelect3">
                    <option value="-1">请选择</option>
                    <option value="1">上架</option>
                    <option value="0">未上架</option>
                </select>
            <#--<button type="submit" class="btn">查找</button>-->
                <input type="submit" class="btn" value="查找"/>
            </form>
            <form action="/daochu" method="post">
            <span>
                <div class="container-fluid">
	<div class="row-fluid">
		<div class="span12">
			 <button class="btn" type="button" id="tianjia">添加</button>
             <input class="btn" type="submit" value="导出">
		</div>
	</div>
</div>
            </span>

            <table class="table">
                <thead>
                <tr>
                    <th>
                        <input type="checkbox" id="selAll">
                    </th>
                    <th>
                        序号
                    </th>
                    <th>
                        商品编码
                    </th>
                    <th>
                        商品条形码
                    </th>
                    <th>
                        商品名称
                    </th>
                    <th>
                        品牌
                    </th>
                    <th>
                        品类
                    </th>
                    <th>
                        销售渠道
                    </th>
                    <th>
                        进货价
                    </th>
                    <th>
                        成本价
                    </th>
                    <th>
                        库存
                    </th>
                    <th>
                        30天销量
                    </th>
                    <th>
                        商品状态
                    </th>
                    <th>
                        操作
                    </th>
                </tr>
                </thead>
                <tbody>

                <#list info.list as comm >
                <tr class="success">
                    <td>
                        <input type="checkbox" name="ids" value="${comm.id!''}">
                    </td>
                    <td>
                        ${comm.id!''}
                    </td>
                    <td>
                        ${comm.commCode!''}
                    </td>
                    <td>
                        ${comm.commBarCode!''}
                    </td>
                    <td>
                        ${comm.commName!''}
                    </td>
                    <td>
                        ${comm.commBrand.bname!''}
                    </td>
                    <td>
                        ${comm.commType.typeName!''}
                    </td>
                    <td>
                        <#list comm.channelList as ch >
                            ${ch.cname}&nbsp;&nbsp;
                        </#list>
                    </td>
                    <td>
                        ${comm.jhPrice!''}
                    </td>
                    <td>
                        ${comm.cbPrice!''}
                    </td>
                    <td>
                        ${comm.goods.znumber!''}
                    </td>
                    <td>
                        ${comm.salesVolume!''}
                    </td>
                    <td>
                        ${comm.status!''}
                    </td>
                    <td>
                        <a href="/shangpin_showBack?commId=${comm.id!''}">编辑</a">
                    </td>
                </tr>
                </#list>
                </form>
                </tbody>
            </table>
            <div class="pagination">
                <ul class="pagination">
                    <li>
                        <#if info.prePage!=0>
                            <a href="/showPage?index=${info.prePage!''}&commName=${commName!''}&brandId=${brandId!''}&commTypeId${commTypeId!''}&status=${status!''}">上一页</a>
                        </#if>
                           <#if info.prePage==0>
                            <a href="/showPage?index=1&commName=${commName!''}&brandId=${brandId!''}&commTypeId${commTypeId!''}&status=${status!''}">上一页</a>
                           </#if>
                    </li>
                    <#list 1..info.pages as p>
                    <li>
                        <a href="/showPage?index=${p}&commName=${commName!''}&brandId=${brandId!''}&commTypeId${commTypeId!''}&status=${status!''}">${p}</a>
                    </li>
                    </#list>
                    <li>
                    <#if info.nextPage!=0>
                        <a href="/showPage?index=${info.nextPage!''}&commName=${commName!''}&brandId=${brandId!''}&commTypeId${commTypeId!''}&status=${status!''}">下一页</a>
                    </#if>
                    <#if info.nextPage==0>
                        <a href="/showPage?index=${info.pages}&commName=${commName!''}&brandId=${brandId!''}&commTypeId${commTypeId!''}&status=${status!''}">下一页</a>
                    </#if>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</div>
</body>
</html>